namespace Vin.Extension.Alibaba.Market.Models;

public class IdCardCheckModel
{
    public string? Msg { get; set; }

    public bool? Success { get; set; }

    /// <summary>
    /// 返回的状态码 200表示成功，其他表示失败
    /// </summary>
    public int? Code { get; set; }

    public Data? Data { get; set; }

    /// <summary>
    /// 检查身份证验证是否成功
    /// </summary>
    /// <returns></returns>
    public (bool, string) IsSuccess()
    {
        if (Code != 200) return (false, Msg ?? "请求失败");
        if (Data == null) return (false, "数据为空");
        return (Data.Result == 0, Data.Desc ?? Msg ?? "验证结果未知");
    }
}

public class Data
{
    /// <summary>
    /// 生日 (格式：yyyyMMdd)
    /// </summary>
    public string? Birthday { get; set; }

    /// <summary>
    /// 0:一致 1:不一致
    /// </summary>
    public int Result { get; set; }

    /// <summary>
    /// 地址
    /// </summary>
    public string? Address { get; set; }

    /// <summary>
    /// 订单编号
    /// </summary>
    public string? OrderNo { get; set; }

    /// <summary>
    /// 性别 男或女
    /// </summary>
    public string? Sex { get; set; }

    /// <summary>
    /// 描述 如：不一致
    /// </summary>
    public string? Desc { get; set; }
}